import re
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel, Field, validator, EmailStr, IPvAnyAddress
from enum import Enum


class DelBaseModel(BaseModel):
    uuid: int = Field(..., description="数据的uuid")


class ClassesContainerHpa(str, Enum):
    class1 = 'ECS服务器'
    class2 = 'deployment'
    class3 = 'statefulset'


class PostContainerHpa(BaseModel):
    name: str = Field(..., description="扩缩容服务的名字")
    classes: ClassesContainerHpa = Field(..., description="扩缩容部署归类")
    state: int = Field(1, description="扩缩容服务的状态:1(使能) or 0(去使能)")
    max: int = Field(..., description="服务最大节点数")
    min: int = Field(..., description="服务最小节点数")
    comment: Optional[str] = Field("", description="扩缩容服务的说明")



class PutContainerHpa(BaseModel):
    uuid: int = Field(..., description="扩缩容服务uuid")
    name: str = Field(..., description="扩缩容服务的名字")
    classes: ClassesContainerHpa = Field(..., description="扩缩容部署归类")
    state: int = Field(1, description="扩缩容服务的状态:1(使能) or 0(去使能)")
    max: int = Field(..., description="服务最大节点数")
    min: int = Field(..., description="服务最小节点数")
    comment: Optional[str] = Field("", description="扩缩容服务的说明")


class ClassesHostDisk(str, Enum):
    class1 = '业务容器'
    class2 = '物理服务'


class PostHostDisk(BaseModel):
    name: str = Field(..., description="服务器名称")
    ip: str = Field(..., description="服务器ip")
    mountpoint: str = Field(..., description="磁盘挂载目录")
    classes: ClassesHostDisk = Field(..., description="服务器归类")
    state: int = Field(1, description="服务器磁盘清理的状态:1(使能) or 0(去使能)")
    script: str = Field(..., description="处理脚本的名称")
    comment: Optional[str] = Field("", description="服务器说明")



class PutHostDisk(BaseModel):
    uuid: int = Field(..., description="扩缩容服务uuid")
    name: str = Field(..., description="服务器名称")
    ip: str = Field(..., description="服务器ip")
    mountpoint: str = Field(..., description="磁盘挂载目录")
    classes: ClassesHostDisk = Field(..., description="服务器归类")
    state: int = Field(1, description="服务器磁盘清理的状态:1(使能) or 0(去使能)")
    script: str = Field(..., description="处理脚本的名称")
    comment: Optional[str] = Field("", description="服务器说明")



class ClassesRabbitmqQueue(str, Enum):
    class1 = 'ECS服务器'
    class2 = 'deployment'
    class3 = 'statefulset'

class PostRabbitmqQueue(BaseModel):
    name: str = Field(..., description="队列名称")
    vhost: str = Field(..., description="虚拟主机")
    cluster: str = Field(..., description="集群名称")
    consumer: str = Field(..., description="消费者服务名")
    classes: ClassesRabbitmqQueue = Field(..., description="消费者服务归类")
    state: int = Field(1, description="使能状态:1(使能) or 0(去使能)")
    max: int = Field(..., description="服务最大节点数")
    comment: Optional[str] = Field("", description="队列说明")


class PutRabbitmqQueue(BaseModel):
    uuid: int = Field(..., description="队列uuid")
    name: str = Field(..., description="队列名称")
    vhost: str = Field(..., description="虚拟主机")
    cluster: str = Field(..., description="集群名称")
    consumer: str = Field(..., description="消费者服务名")
    classes: ClassesRabbitmqQueue = Field(..., description="消费者服务归类")
    state: int = Field(1, description="使能状态:1(使能) or 0(去使能)")
    max: int = Field(..., description="服务最大节点数")
    comment: Optional[str] = Field("", description="队列说明")